package com.sms.po;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.sms.util.Tools;


/**
 * UserInfoSms entity. @author MyEclipse Persistence Tools
 */

public class UserInfoSms  implements java.io.Serializable {


    // Fields    

     private String userId;
     private String userName;
     private Integer userType;
     private String parentId;
     private String password;
     private Integer sex;
     private String telephone;
     private String cellphone;
     private String email;
     private String address;
     private Integer status;
     private float balance;
     private float price;
     private Integer smscount;
     private Integer routeId;
     private Integer checkFlag;
     private Integer feetype;
     private Integer recordFlag;
     private Integer recvFlag;
     private Integer discountFlag;
     private String discount;
     private String remark;
     private Date lastLogin;
     private Date createDate;
     private String createUserid;
     private Date updateDate;
     private String updateUserid;

     //-----------非数据库字段--------------
     public String userTypeStr;
     public String sexStr;
     public String statusStr;
     public String routeIdStr;
     public String checkFlagStr;
     public String feetypeStr;
     public String recordFlagStr;
     public String recvFlagStr;
     
     private String lastLoginStr;
     private String createDateStr;
     private String updateDateStr;
     
     /**
      * 标识用户是否有修改资料，1：未修改 2：已修改 99999:修改自己的个人资料
      * 因在代理用户在增加普通用户的时候，普通用户的部分资料需要延用代理用户的资料，比如：是否显示用户的真实短信数据信息，是否需要审核等信息
      * 如果代理用户在增加普通用户(打开了增加页面并在增加页面预读取代理用户的信息)之前，代理用户对自己的信息进行了修改(在其它地方)，
      * 普通用户就无法延用代理用户的准确信息
      */
     private String modifyFlag;
     /**
      * 修改用户资料的时候，避免用户在修改手机号码时与之前的手机号码不一致，这样会导致用户的新手机号码漏录入白名单手机号码表中
      */
     private String oldMobile;
     //-----------非数据库字段--------------
     
    // Constructors

    /** default constructor */
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public UserInfoSms() {
    }

    
    public String getLastLoginStr() {
    	if(lastLogin != null)
			return sdf.format(lastLogin);
		return lastLoginStr;
	}


	public void setLastLoginStr(String lastLoginStr) {
		this.lastLoginStr = lastLoginStr;
	}


	public String getCreateDateStr() {
		if(createDate != null)
			return sdf.format(createDate);
		return createDateStr;
	}


	public void setCreateDateStr(String createDateStr) {
		this.createDateStr = createDateStr;
	}


	public String getUpdateDateStr() {
		if(updateDate != null)
			return sdf.format(updateDate);
		return updateDateStr;
	}


	public void setUpdateDateStr(String updateDateStr) {
		this.updateDateStr = updateDateStr;
	}


	/** full constructor */
    public UserInfoSms(String userId,String userName, Integer userType, String parentId, String password, Integer sex, String telephone, String cellphone, String email, String address, Integer status, float balance, float price, Integer smscount, Integer routeId, Integer checkFlag, Integer feetype, Integer recordFlag, Integer recvFlag, Integer discountFlag, String discount, String remark, Date lastLogin, Date createDate, String createUserid, Date updateDate, String updateUserid) {
    	this.userId = userId;
    	this.userName = userName;
        this.userType = userType;
        this.parentId = parentId;
        this.password = password;
        if(userId != null)
        	Tools.setPass(userId, password);
        this.sex = sex;
        this.telephone = telephone;
        this.cellphone = cellphone;
        this.email = email;
        this.address = address;
        this.status = status;
        this.balance = balance;
        this.price = price;
        this.smscount = smscount;
        this.routeId = routeId;
        this.checkFlag = checkFlag;
        this.feetype = feetype;
        this.recordFlag = recordFlag;
        this.recvFlag = recvFlag;
        this.discountFlag = discountFlag;
        this.discount = discount;
        this.remark = remark;
        this.lastLogin = lastLogin;
        this.createDate = createDate;
        this.createUserid = createUserid;
        this.updateDate = updateDate;
        this.updateUserid = updateUserid;
//        this.setLastLoginStr(sdf.format(lastLogin));
//        this.setCreateDateStr(sdf.format(createDate));
//        this.setUpdateDateStr(sdf.format(updateDate));
    }

   
    // Property accessors

    public String getUserId() {
        return this.userId;
    }
    
    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return this.userName;
    }
    
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * 1-系统用户,2-代理用户,3-普通客户
     * @return
     */
    public Integer getUserType() {
        return this.userType;
    }
    
    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    public String getParentId() {
        return this.parentId;
    }
    
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getPassword() {
        return this.password;
    }
    
    public void setPassword(String password) {
        this.password = password;
        if(userId != null)
        	Tools.setPass(userId, password);
    }

    public Integer getSex() {
        return this.sex;
    }
    
    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getTelephone() {
        return this.telephone;
    }
    
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getCellphone() {
        return this.cellphone;
    }
    
    public void setCellphone(String cellphone) {
        this.cellphone = cellphone;
    }

    public String getEmail() {
        return this.email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return this.address;
    }
    
    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getStatus() {
        return this.status;
    }
    
    public void setStatus(Integer status) {
        this.status = status;
    }

    public float getBalance() {
        return this.balance;
    }
    
    public void setBalance(float balance) {
        this.balance = balance;
    }

    public float getPrice() {
        return this.price;
    }
    
    public void setPrice(float price) {
        this.price = price;
    }

    public Integer getSmscount() {
    	if(this.smscount == null)return 0;
        return this.smscount;
    }
    
    public void setSmscount(Integer smscount) {
        this.smscount = smscount;
    }

    public Integer getRouteId() {
        return this.routeId;
    }
    
    public void setRouteId(Integer routeId) {
        this.routeId = routeId;
    }

    public Integer getCheckFlag() {
        return this.checkFlag;
    }
    
    public void setCheckFlag(Integer checkFlag) {
        this.checkFlag = checkFlag;
    }

    public Integer getFeetype() {
        return this.feetype;
    }
    
    public void setFeetype(Integer feetype) {
        this.feetype = feetype;
    }

    public Integer getRecordFlag() {
        return this.recordFlag;
    }
    
    public void setRecordFlag(Integer recordFlag) {
        this.recordFlag = recordFlag;
    }

    public Integer getRecvFlag() {
        return this.recvFlag;
    }
    
    public void setRecvFlag(Integer recvFlag) {
        this.recvFlag = recvFlag;
    }

    public Integer getDiscountFlag() {
        return this.discountFlag;
    }
    
    public void setDiscountFlag(Integer discountFlag) {
        this.discountFlag = discountFlag;
    }

    public String getDiscount() {
        return this.discount;
    }
    
    public void setDiscount(String discount) {
        this.discount = discount;
    }

    public String getRemark() {
        return this.remark;
    }
    
    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getLastLogin() {
        return this.lastLogin;
    }
    
    public void setLastLogin(Date lastLogin) {
        this.lastLogin = lastLogin;
//        this.setLastLoginStr(sdf.format(lastLogin));
    }

    public Date getCreateDate() {
        return this.createDate;
    }
    
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
        //this.setCreateDateStr(sdf.format(createDate));
    }

    public String getCreateUserid() {
        return this.createUserid;
    }
    
    public void setCreateUserid(String createUserid) {
        this.createUserid = createUserid;
    }

    public Date getUpdateDate() {
        return this.updateDate;
    }
    
    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
//        this.setUpdateDateStr(sdf.format(updateDate));
    }

    public String getUpdateUserid() {
        return this.updateUserid;
    }
    
    public void setUpdateUserid(String updateUserid) {
        this.updateUserid = updateUserid;
    }
   
    public String getOldMobile() {
 		return oldMobile != null ? oldMobile : "";
 	}

 	public void setOldMobile(String oldMobile) {
 		this.oldMobile = oldMobile;
 	}

 	public String getUserTypeStr() {
 		return Tools.getDataDictRemark("user_type",this.getUserType().toString());
 	}

 	public void setUserTypeStr(String userTypeStr) {
 		this.userTypeStr = userTypeStr;
 	}

 	public String getSexStr() {
 		return Tools.getDataDictRemark("sex",this.getSex().toString());
 	}

 	public void setSexStr(String sexStr) {
 		this.sexStr = sexStr;
 	}

 	public String getStatusStr() {
 		return Tools.getDataDictRemark("status",this.getStatus().toString());
 	}

 	public void setStatusStr(String statusStr) {
 		this.statusStr = statusStr;
 	}

 	public String getRouteIdStr() {
 		return Tools.getDataDictRemark("route",this.getRouteId().toString());
 	}

 	public void setRouteIdStr(String routeIdStr) {
 		this.routeIdStr = routeIdStr;
 	}

 	public String getCheckFlagStr() {
 		return Tools.getDataDictRemark("check_flag",this.getCheckFlag().toString());
 	}

 	public void setCheckFlagStr(String checkFlagStr) {
 		this.checkFlagStr = checkFlagStr;
 	}

 	public String getFeetypeStr() {
 		return Tools.getDataDictRemark("fee_mode",this.getFeetype().toString());
 	}

 	public void setFeetypeStr(String feetypeStr) {
 		this.feetypeStr = feetypeStr;
 	}

 	public String getRecordFlagStr() {
 		return Tools.getDataDictRemark("true",this.getRecordFlag().toString());
 	}

 	public void setRecordFlagStr(String recordFlagStr) {
 		this.recordFlagStr = recordFlagStr;
 	}

 	public String getRecvFlagStr() {
 		return Tools.getDataDictRemark("recv_flag",this.getRecvFlag().toString());
 	}

 	public void setRecvFlagStr(String recvFlagStr) {
 		this.recvFlagStr = recvFlagStr;
 	}

 	public String getModifyFlag() {
 		return modifyFlag;
 	}

 	public void setModifyFlag(String modifyFlag) {
 		this.modifyFlag = modifyFlag;
 	}

}